import { Button, Modal } from "antd-mobile";
import React, { useEffect } from "react";
import { isValidArr } from "@/utils";
import { BASE_PATH } from "@/config";
import { CloseCircleFill, CloseCircleOutline } from "antd-mobile-icons";

export default function callFeedback({title, content, header, actions, answer, hideClose, ...props}) {

  const c = Modal.show({
    bodyClassName: `act-border-wrapper act-feedback-modal close-at-center-bottom`,
    content: <div className="inner">
      {
        !hideClose &&
        <div className="close-btn" onClick={e => c.close()}><CloseCircleOutline /></div>
      }

      {
        header &&
        <div className="header">{header}</div>
      }
      {
        title &&
        <div className="title">{title}
        </div>
      }
      {
        content &&
        <div className="content">
          {content}
        </div>
      }

      <div className="operation">
        {
          isValidArr(actions) || typeof actions === `object` ?
            actions : <Button onClick={e => c.close()}  className="act-btn act-btn-primary cla">确定</Button>
        }
      </div>
    </div>,
    closeOnAction: true,
    closeOnMaskClick: true,
    ...props
  })

  return c
}